
package org.apache.solr.update;

import java.util.List;
import org.apache.solr.common.cloud.HashPartitioner;
import org.apache.solr.core.SolrCore;
import org.apache.solr.request.SolrQueryRequest;

/**
 * A merge indexes command encapsulated in an object.
 *
 * @since solr 1.4
 *
 */
public class SplitIndexCommand extends UpdateCommand {
    // public List<Directory> dirs;

    public List<String> paths;
    public List<SolrCore> cores;  // either paths or cores should be specified
    public List<HashPartitioner.Range> ranges;
    // TODO: allow specification of custom hash function

    public SplitIndexCommand(SolrQueryRequest req, List<String> paths, List<SolrCore> cores, List<HashPartitioner.Range> ranges) {
        super(req);
        this.paths = paths;
        this.cores = cores;
        this.ranges = ranges;
    }

    @Override
    public String name() {
        return "split";
    }

    @Override
    public String toString() {

        StringBuilder sb = new StringBuilder(super.toString());
        sb.append(",paths=").append(paths);
        sb.append(",cores=").append(cores);
        sb.append(",ranges=").append(ranges);
        sb.append('}');
        return sb.toString();
    }
}
